
env = Environment()

env.Append( CPPPATH=['agent/','front/','network/','thread', 'connection'])

myfile = env.Command( ['network/com.pb.cc', 'network/com.pb.h'], 'com.proto', 'cd ./$SOURCE.dir && protoc --cpp_out=network/ $SOURCE.file')
print myfile
#NetworkLib = env.StaticLibrary("Network",['network/com.pb.cc'], myfile)
NetworkLib = env.StaticLibrary("Network",myfile)

ThreadLib = env.StaticLibrary("Thread", Glob('thread/*.cpp'))
#NetworkLib = env.StaticLibrary("Network",[Glob('network/*.cpp'),['network/com.pb.cc'] ])
FrontEngineLib = env.StaticLibrary("FrontEngine", Glob('front/*.cpp'))
AgentLib = env.StaticLibrary("Agent", Glob('agent/*.cpp'))
ConnectionLib = env.StaticLibrary("Connection", Glob('connection/*.cpp'))


env.Append( CPPFLAGS=['-Wall', '-std=gnu++0x', '-O0'] )
env.Append( LINKFLAGS="--static" )

libraries = ['protobuf','boost_system','boost_filesystem', 'pthread','pcap++','pcap','protobuf','nsl','z','m']
env.Append( LIBS = [AgentLib,NetworkLib,FrontEngineLib,ThreadLib,ConnectionLib, libraries])

env.Program('../program', ['main.cpp'])

env.Program('../front_engine', ['front.cpp'])
env.Program('../agent_jpg', ['agent_jpg.cpp'])


env.Program('../main_connection_server', ['main_connection_server.cpp'], LIBS = [ConnectionLib,NetworkLib, libraries])
env.Program('../main_connection_client', ['main_connection_client.cpp'], LIBS = [ConnectionLib,NetworkLib, libraries])
